package correct.day20;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        char[] s = in.next().toCharArray();
        int n = s.length;
        boolean flag = false;
        for(int i = 1; i < n; i++)
        {
            if(s[i] != s[0])
            {
                flag = true;
                break;
            }
        }

        if(flag == true) // 不是相同的字符
        {
            flag = false;
            // 判断本⾝是不是回⽂
            int left = 0, right = n - 1;
            while(left < right)
            {
                if(s[left] == s[right])
                {
                    left++;
                    right--;
                }
                else
                {
                    flag = true;
                    break;
                }
            }
            if(flag == true)
                System.out.println(n);
            else
                System.out.println(n - 1);
        }
        else // 是相同字符
        {
            System.out.println(0);
        }
    }
}
